<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class StoreAdminPost extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            //
            'tel'=>['required','regex:/^[1][3,4,5,6,7,8,9][0-9]{9}$/'],
            'password'=>'required',
        ];
    }

    /**
     * 自定义错误信息
     *
     * @return array
     */
    public function messages()
    {
        return [
            'tel.required'=>'手机号不能为空！',
            'tel.regex'=>'您填写的手机格式不正确！',
            'password.required'=>'密码不能为空！'
        ];
    }
}
